/*
 * Copyright (c) 2016, Inspur, All Rights Reserved.
 */

package com.pazu.hibernate.demo.core.dao;

import org.springframework.orm.hibernate3.HibernateTemplate;

import com.pazu.hibernate.demo.core.pojo.BasePojo;

/**
 * <br/>
 * Date: 2016年2月4日 下午3:01:57 <br/>
 * @author Pazu Lee
 * @since v5.0
 * @see
 */
public interface BaseDao<T extends BasePojo> {

    /**
     * create:. create pojo<br/>
     * @author Pazu Lee
     * @param t
     * @return pojo with id generated
     * @since v5.0
     */
    public T create(T t);

    /**
     * update:. update pojo<br/>
     * @author Pazu Lee
     * @param t
     * @return pojo
     * @since v5.0
     */
    public T update(T t);

    /**
     * delete:. delete pojo<br/>
     * @author Pazu Lee
     * @param t
     * @since v5.0
     */
    public void delete(T t);

    /**
     * getById:. get pojo by pojo id<br/>
     * @author Pazu Lee
     * @param id
     *            the unique key of pojo
     * @return the pojo or null obj
     * @since v5.0
     */
    public T getById(Class<T> clazz, String id);

    /**
     * deleteById:. delete the pojo if exists one that unique key equals the id<br/>
     * @author Pazu Lee
     * @param id
     *            the unique key of pojo
     * @since v5.0
     */
    public void deleteById(String id);
    
    public HibernateTemplate getTemplate();

}
